function ChessBoardTracker() {

	const CHESS_SCORE_LINK5              =  0x10000000;
	const CHESS_SCORE_ALIVE4             =  0x01000000;
	
	const CHESS_SCORE_IMPACTIVE4             =  0x00100000;
	const CHESS_SCORE_ALIVE3             =  0x00100000;
	
	const CHESS_SCORE_SLEEP3             =  0x00010000;
	const CHESS_SCORE_ALIVE2             =  0x00001000;
	
	const CHESS_SCORE_SLEEP2             =  0x00000100;
	const CHESS_SCORE_ALIVE1             =  0x00000010;
	
	const CHESS_SCORE_SLEEP1             =  0x00000001;
	
	const CHESS_SCORE_DEAD               =  0x00000000;



	var statechangefunc = null;

	/*Create a table,and initialize it*/	
	var table = new Array(ChessInfo.chessboardrows);

	this.mytable = new Array(ChessInfo.chessboardrows);
	this.optable = new Array(ChessInfo.chessboardrows);
	
	for (i = 0; i < ChessInfo.chessboardrows; i++) {
		this.mytable[i] = new Array(ChessInfo.chessboardcolumns);
		this.optable[i] = new Array(ChessInfo.chessboardcolumns);
		for (j = 0; j < ChessInfo.chessboardcolumns; j++) {
			this.mytable[i][j] = 0;
			this.optable[i][j] = 0;
		}
	}

	this.init = function() {
		for (var i = 0; i < ChessInfo.chessboardrows; i++) {
			table[i] = new Array(ChessInfo.chessboardcolumns);
		}		
		this.clean();
	};
	
	this.clean = function() {
		for (var i = 0; i < ChessInfo.chessboardrows; i++) {
			for (var j = 0; j < ChessInfo.chessboardcolumns; j++) {
				table[i][j] = CHESS_EMPTY;
			}
		}
	};
	
	this.setChess = function(x, y, chess) {
		table[y][x] = chess;
	};
	
	this.getChess = function(x, y) {
		return table[y][x];
	};
	
	this.checkChessSituation(result, chess) {
		var score = 0;
		var chessop = (chess + 1) % 2;
	
		if (result.indexOf("11111") != -1) {
			/* chess link 5 */
			score += CHESS_SCORE_LINK5;
		} else if (result.indexOf("011110") != -1) {
			/* chess alive 4 */
			score += CHESS_SCORE_ALIVE4;
		} else if ((result.indexOf("F11110") != -1) || (result.indexOf("01111F") != -1)
				|| (result.indexOf("11101") != -1) || (result.indexOf("10111") != -1)
				|| (result.indexOf("11011") != -1)){
			/* chess impactive 4 */
			score += CHESS_SCORE_IMPACTIVE4;
		} else if ((result.indexOf("01110") != -1) 
				|| (result.indexOf("011010") != -1) || (result.indexOf("010110") != -1)) {
			/* chess alive 3 */
			score += CHESS_SCORE_ALIVE3;
		} else if ((result.indexOf("F11100") != -1) || (result.indexOf("00111F") != -1)
				|| (result.indexOf("F11010") != -1) || (result.indexOf("01011F") != -1)
				|| (result.indexOf("11001") != -1) || (result.indexOf("10011") != -1)
				|| (result.indexOf("10101") != -1)) {
			/* chess sleep 3 */
			score += CHESS_SCORE_SLEEP3;
		} else if ((result.indexOf("00110") != -1) || (result.indexOf("01100") != -1)
				|| (result.indexOf("01010") != -1)
				|| (result.indexOf("010010") != -1)) {
			/* chess alive 2 */
			score += CHESS_SCORE_ALIVE2;
		} else if ((result.indexOf("F11000") != -1) || (result.indexOf("00011F") != -1)
				|| (result.indexOf("F10100") != -1) || (result.indexOf("00101F") != -1)
				|| (result.indexOf("01001") != -1) || (result.indexOf("10010") != -1)
				|| (result.indexOf("10001") != -1)){
			/* chess sleep 2 */
			score += CHESS_SCORE_SLEEP2;
		} else if ()

	};
	
	this.scan = function(x, y, chess) {
		if (table[y][x] == CHESS_EMPTY) {
			table[y][x] = chess;
			for (var i = 0; i < ChessScan.SCAN_DIR_COUNTS; i++) {
				result = ChessScan.scan(x, y, i);
			}			
			table[y][x] = CHESS_EMPTY;
		}
	};
}